﻿
using System;
using System.Web;
using System.Collections.Generic;
using BLToolkit.Mapping;
using BLToolkit.Data;
using BLToolkit.Reflection;

/// <summary>Route_id</summary>
public class Route : LoggingObject
{
	public Route()
	{
		SourceStation = new Station();
		TargetStation = new Station();
	}

	[Nullable]
	[MapField("Route_id")]
	public Int64 Id { get; set; }

	/// <summary>id станции отправления</summary>
	[Nullable]
	public Int64 SourceStation_id { get { return SourceStation.Id; } }
	/// <summary>Станция отправления</summary>
	[Nullable]
	public Station SourceStation { get; set; }

	/// <summary>id конечной станции</summary>
	[Nullable]
	public Int64 TargetStation_id { get { return TargetStation.Id; } }
	/// <summary>Конечная станция</summary>
	[Nullable]
	public Station TargetStation { get; set; }

	/// <summary>Название маршрута</summary>
	[Nullable]
	[MapField("Route_name")]
	public string Name { get; set; }

	public bool Merge()
	{
		try
		{
			SetLoggingInfo();
			this.Id = DBEntity<Route>.Merge(this);
			return true;
		}
		catch { return false; }
	}
}
